package com.woniu.microworkorderserver.workadminmag.mapper;


import com.woniu.microcommonsserver.entity.WorkListInfoEntity;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface WorDispatchMapper {

    //工单调度页面下的根据工单状态显示页面的表格数据
    List<WorkListInfoEntity> findAll(String status);

    //工单调度页面下子页面 已接工单下的----退单按钮
    @Update("update  work_list_info set wrk_status = '待审' where id = #{id}")
    int updateFishedAccept(int id);


    //工单调度页面下子页面 待审工单下的----通过按钮
    @Update("update  work_list_info set wrk_status = '已接' where id = #{id}")
    int allowWork(int id);

    //工单调度页面下子页面 待审工单下的----驳回按钮
    @Update("update  work_list_info set wrk_status = '已驳回' where id = #{id}")
    int rejectWork(int id);


    //新增报修
    @Insert("insert into work_list_info (wrk_num,wrk_status,wrk_project,wrk_type,wrk_create_time,priority,space,repair_person,system,repair_type," +
            "facility_type,asset_nam,trouble_desc,live_picture,asset_type,admin_idea,admin_telphone,work_title,repair_telphone)" +
            "values (#{w.wrkNum},#{w.wrkStatus},#{w.wrkProject},#{w.wrkType},now(),#{w.priority},#{w.space},#{w.repairPerson},#{w.system},#{w.repairType}" +
            ",#{w.facilityType},#{w.assetNam},#{w.troubleDesc},#{w.livePicture},#{w.assetType},#{w.adminIdea},#{w.adminTelphone},#{w.workTitle},#{w.repairTelphone})")
    int insertRepair(@Param("w") WorkListInfoEntity workListInfoEntity);


    //派单
    @Update("update work_list_info set  wrk_status='进行中' ,actrul_start=#{w.actrulStart}, prict_work_time=#{w.prictWorkTime},remark=#{w.remark},work_group=#{w.workGroup},accept_person=#{w.acceptPerson} where id =#{w.id}")
    int saveInsert(@Param("w")WorkListInfoEntity workListInfoEntity);



    @Update("update work_list_info set wrk_status = '已接' where id=#{id}")
    int stopingById(int id);
}
